﻿<catel:DataWindow x:Class="Caitlyn.Views.RootProjectView"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				  xmlns:catel="http://catel.codeplex.com" 
                  xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                  xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase">
    
    <!-- Resources -->
    <catel:DataWindow.Resources>
        <CollectionViewSource Source="{Binding Rules}" x:Key="rulesCollectionViewSource">
            <CollectionViewSource.SortDescriptions>
                <scm:SortDescription PropertyName="Name"/>
            </CollectionViewSource.SortDescriptions>
        </CollectionViewSource>
    </catel:DataWindow.Resources>

    <!-- Content -->
    <catel:StackGrid x:Name="rootProjectViewRoot">
		<catel:StackGrid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</catel:StackGrid.RowDefinitions>

        <catel:StackGrid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="600" />
        </catel:StackGrid.ColumnDefinitions>

        <Label Content="Name" />
        <ComboBox ItemsSource="{Binding AvailableProjects}" SelectedItem="{Binding Name, NotifyOnValidationError=True, ValidatesOnDataErrors=True}"/>

        <GroupBox Header="Ignored items" catel:StackGrid.ColumnSpan="2">
            <StackPanel>
                <ListView ItemsSource="{Binding Source={StaticResource rulesCollectionViewSource}}" SelectedItem="{Binding SelectedRule}" Height="300" SelectionMode="Single">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="MouseDoubleClick">
                            <catel:EventToCommand Command="{Binding Edit}" DisableAssociatedObjectOnCannotExecute="False" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <ListView.View>
                        <GridView>
                            <GridViewColumn DisplayMemberBinding="{Binding Name}" Width="475" Header="Name" />
                            <GridViewColumn DisplayMemberBinding="{Binding Type}" Width="100" Header="Type" />
                        </GridView>
                    </ListView.View>
                </ListView>

                <WrapPanel>
                    <Button Command="{Binding Add}" ToolTip="Add..." Style="{StaticResource ImageButtonStyle}">
                        <Image Source="/Caitlyn;component/Resources/Images/action_add.png" Stretch="None" />
                    </Button>

                    <Button Command="{Binding Edit}" ToolTip="Edit..." Style="{StaticResource ImageButtonStyle}">
                        <Image Source="/Caitlyn;component/Resources/Images/action_edit.png" Stretch="None" />
                    </Button>

                    <Button Command="{Binding Remove}" ToolTip="Remove" Style="{StaticResource ImageButtonStyle}">
                        <Image Source="/Caitlyn;component/Resources/Images/action_remove.png" Stretch="None" />
                    </Button>
                </WrapPanel>
            </StackPanel>
        </GroupBox>
        
    </catel:StackGrid>
</catel:DataWindow>
